package cn.com.bdqn.dao;

import cn.com.bdqn.entity.CstCustomer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CstCustomerDao {

    public List<CstCustomer> queryByLike(CstCustomer customer);

    @Select("select * from cst_customer where cust_no = #{value};")
    public CstCustomer queryByCustNo(String custNo);

    @Insert("insert into cst_customer(cust_no,cust_name,cust_level_label,cust_status) values\n" +
            "(#{custNo},#{custName},'普通客户',1);")
    public int addCstCustomer(CstCustomer customer);

    @Select("select * from cst_customer where cust_no like concat('%',#{bidDate},'%') order by cust_no desc limit 1;")
    public CstCustomer queryByDate(String bidDate);

    public int updateCstCustomer(CstCustomer customer);

    @Update("update cst_customer set cust_status = 2 where cust_no = #{value}")
    public int updateCustStatus(String id);
}
